public class SuShu {
    public static void main(String[] args) {
       
       
        int[] numArray=new int[20000];

        int index=0;
 
        for (int i = 1; i <=20000 ; i++) {
            for (int j = 2; j <=i ; j++) {
               
                if(i%j==0&&i!=j){
                    break;
                }
                if(i==j){
                    numArray[index]=i;
                    index++;
                }
            }
        }
      
        int count=0;
        for (int i = 0; i < numArray.length; i++) {
            if(numArray[i]!=0) {
                System.out.print(numArray[i]+"\t");
                count+=1;
            }
           
            if(count%5==0){
                System.out.println();
            }
        }
    }
}

